From ae9db74d17a7aec713bfcc152e8a631befb44783 Mon Sep 17 00:00:00 2001 From: "kfraser@localhost.localdomain" Date: Wed, 11 Jul 2007 10:52:19 +0100 Subject: [PATCH] [xenstore] adds a -w (wide) flag to xenstore-ls to support seeing full contents of xenstore entries. There is a bit of code cleanup as well (snprintf vs. sprintf), one formatting fix, and comments). There is no change to the behavior of xenstore-ls without -w. Signed-off-by: John Zulauf --- tools/xenstore/xsls.c | 37 ++++++++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/tools/xenstore/xsls.c b/tools/xenstore/xsls.c index cf5ff6e7e6..c9e41ef64e 100644 --- a/tools/xenstore/xsls.c +++ b/tools/xenstore/xsls.c @@ -8,6 +8,7 @@ #include #include +#define STRING_MAX PATH_MAX static int max_width = 80; static int desired_width = 60; @@ -19,7 +20,8 @@ static int desired_width = 60; void print_dir(struct xs_handle *h, char *path, int cur_depth, int show_perms) { char **e; - char newpath[512], *val; + char newpath[STRING_MAX], *val; + int newpath_len; int i; unsigned int num, len; @@ -33,13 +35,26 @@ void print_dir(struct xs_handle *h, char *path, int cur_depth, int show_perms) unsigned int nperms; int linewid; - for (linewid=0; linewid